package com.codingman.springjdbcdemo1;

import org.springframework.jdbc.core.JdbcTemplate;

public class EmployeeDao1 {
	private JdbcTemplate template;

	public JdbcTemplate getTemplate() {
		return template;
	}

	public void setTemplate(JdbcTemplate template) {
		this.template = template;
	}

	public int save(Employee e){  
	    String query="insert into employee values('"+e.getId()+"','"+e.getName()+"','"+e.getSalary()+"')";  
	    return template.update(query);
	}

	public int update(Employee e){  
	    String query="update employee set name='"+e.getName()+"',salary='"+e.getSalary()+"' where id='"+e.getId()+"' ";  
	    return template.update(query);  
	}

	public int delete(Employee e) {
		String query = "delete from employee where id='" + e.getId() + "' ";
		return template.update(query);
	}
}
